//
//  PopChooseBankCardVIew.m
//  MRBang
//
//  Created by 铅笔 on 16/4/21.
//  Copyright © 2016年 杭州易网新科技. All rights reserved.
//

#import "PopChooseBankCardVIew.h"

@interface PopChooseBankCardVIew ()<UITableViewDataSource,UITableViewDelegate>

@property (nonatomic,strong) UITableView *tableView_choseView;

@end

@implementation PopChooseBankCardVIew

- (id) initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        [self initWithPopChooseBankCardVIewSubviews];
    }
    return self;
}

- (void) initWithPopChooseBankCardVIewSubviews
{
    self.tableView_choseView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth-2*160*PROPORTION_WIDTH, 200)];
    [self addSubview:self.tableView_choseView];
    self.tableView_choseView.dataSource = self;
    self.tableView_choseView.delegate = self;
    self.tableView_choseView.separatorStyle = UITableViewCellSeparatorStyleNone;

}

#pragma mark --- UITableViewDataSource
- (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.mutableArray_allModel.count;

}

- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{

    static NSString *cellPopChooseBankCardVIewID = @"cellPopChooseBankCardVIewID";
    UITableViewCell *cell_chose = [tableView cellForRowAtIndexPath:indexPath];
    if (cell_chose==nil) {
        cell_chose = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellPopChooseBankCardVIewID];
    }
    
    UILabel *label_name = [[UILabel alloc] initWithFrame:CGRectMake(0, 25*PROPORTION_WIDTH,self.tableView_choseView.width, 30*PROPORTION_WIDTH)];
    [cell_chose.contentView addSubview:label_name];
    label_name.textAlignment = NSTextAlignmentCenter;
    
    HelpMeDoModel *model_help = self.mutableArray_allModel[indexPath.row];
    label_name.text = model_help.name;
    label_name.font = [UIFont systemFontOfSize:Font_SIZE_24];
    
    return cell_chose;
}

- (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 80*PROPORTION_WIDTH;

}

- (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if ([self.choseBankDelegate respondsToSelector:@selector(chooseOneBankCardAction:)]) {
        [self.choseBankDelegate chooseOneBankCardAction:self.mutableArray_allModel[indexPath.row]];
    }
}

@end
